Skip to content

AppSideNav: fix scrolling issue and being able to focus hidden links issue #2869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 15, 2025

Conversation

shleewhite
Copy link
Contributor

@shleewhite shleewhite commented May 12, 2025

📌 Summary

If merged, this PR would do some cleanup of the AppSideNav component

  • only lock scrolling if the user is on mobile (when on desktop, scrolling shouldnt be prevented because the user can still interact with the rest of the page)
  • reset ability to scroll when close the AppSideNav with the escape key
  • prevent the user from tabbing to the body of the AppSideNav when it is minimized

There are also updates to tests to check for the correct behavior (+ 1 bonus fix for a Modal test):

  • add test to check the user cannot tab to the content when the AppSideNav is minimized
  • add checks to existing tests that overflow: hidden is set appropriately
  • add test that when a user resizes from mobile -> desktop, ability to scroll is returned
  • re-enable test for Modal because I figured out how to target the body element in tests

🧪 Tested in Atlas:

🔗 External links

Jira ticket: HDS-4827
Jira ticket: HDS-4858


👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented May 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview May 15, 2025 0:36am
hds-website ✅ Ready (Inspect) Visit Preview May 15, 2025 0:36am

@shleewhite shleewhite marked this pull request as ready for review May 13, 2025 11:44
@shleewhite shleewhite requested a review from a team as a code owner May 13, 2025 11:44
@shleewhite shleewhite changed the title AppSideNav: fix scrolling issue, AppSideNav: fix scrolling issue and being able to focus hidden links issue May 13, 2025
@shleewhite shleewhite added the release-candidate Publishes release candidates to npm label May 13, 2025
Copy link
Contributor

github-actions bot commented May 13, 2025

📦 RC Packages Published

Latest commit: 345c550

Published 1 packages

@hashicorp/[email protected]

yarn up -C @hashicorp/design-system-components@rc

@shleewhite shleewhite removed the release-candidate Publishes release candidates to npm label May 13, 2025

More specifically:

- `minimized → maximized` transition: the content appears with a fade-in effect, when the width animation is already completed (the width is maximized)
- `maximized → minimized` transition: the content disappears at once with no transition, before the width animation starts

Another option is to use the **`isMinimized` parameter**, which is useful in those cases where the content is so custom/specialized that it can’t just be faded in/out but needs to have a different kind of transition (eg. remain visible but change layout or respond to the width of the container). This value is passed down by the `<:header/body/footer>` named blocks as parameters, and can be used to build custom logic on the consumers’ side.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component doesn't return named blocks or the isMinimized state to the consumer, so this is not true.

Copy link
Contributor

@KristinLBradley KristinLBradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good overall but I had a few questions still (see comments)

@shleewhite shleewhite added this to the [email protected] milestone May 14, 2025
@shleewhite shleewhite requested a review from a team May 14, 2025 16:39
@shleewhite shleewhite force-pushed the hds-4827/app-side-nav-overflow-bug branch from 1a2188c to ffb7563 Compare May 14, 2025 21:14
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shleewhite left a bunch of comments/questions, but overall the PR is so much better and clean with your latest changes! 🙌

Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested the changes in a production environment (I imagine you have done it) but the code review is OK for me.
Well, not just OK: this is a great PR. 👏 👏 👏

@shleewhite shleewhite added release-candidate Publishes release candidates to npm and removed release-candidate Publishes release candidates to npm labels May 15, 2025
Copy link
Contributor

@KristinLBradley KristinLBradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@shleewhite shleewhite removed the release-candidate Publishes release candidates to npm label May 15, 2025
@shleewhite shleewhite merged commit 50afd67 into main May 15, 2025
18 checks passed
@shleewhite shleewhite deleted the hds-4827/app-side-nav-overflow-bug branch May 15, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-website Content updates to the documentation website packages/components showcase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants